//
//  ProductObject.m
//  PurchasingMeeting
//
//  Created by zhuang yihang on 7/10/13.
//  Copyright (c) 2013 YX. All rights reserved.
//

#import "ProductObject.h"
#import "FMDatabase.h"
#import "DataManager.h"

@interface ProductObject(){
    NSString *pURL_;
}

@end

@implementation ProductObject

@synthesize keyObject;

@synthesize pCode,pName,pSale,pSerial;
@synthesize pType,pSeason,pExihibition,pNote;
@synthesize pColorCode,pSizeGroupID;
@synthesize pRecommend,pRecommendCode;
@synthesize pURL=pURL_;
@synthesize pZhanting,pFengge,pBanxing,pxilie,isordering;
@synthesize pSerialCode,pTypeCode,pSeasonCode,pIntroDateCode,pxilieCode;
@synthesize simCode,mianliao;
- (id)init{
    self = [super init];
    if (self) {
        
    }
    return self;
}

- (BOOL)isTheSameProduct:(ProductObject *)product{
    if (![product.pCode isEqualToString:self.pCode]) {
        return NO;
    }
    
    if (![product.pColorCode isEqualToString:self.pColorCode]) {
        return NO;
    }
    
    return YES;
}

- (void)setPURL:(NSString *)pURL{
    pURL_ = pURL;
    self.pThumbURL = [NSString stringWithFormat:@"_%@",pURL];
}

- (id)getValueByKey:(NSString *)key{
    if (keyObject) {
        return [NSString stringWithFormat:@"%@",[keyObject objectForKey:key]];
    }
    return @"";
}

- (NSString *)pColor{
#ifdef XLarge_ENABLE
    int type = [[DataManager sharedManager]isAddtionProduct:pCode];
    if (type==3) {
        return [NSString stringWithFormat:@"%@(加大)",_pColor];
    }else if(type==4){
        return [NSString stringWithFormat:@"%@(加裤)",_pColor];
    }else if(type==1){
        return [NSString stringWithFormat:@"%@(单褶)",_pColor];
    }else if(type==4){
        return [NSString stringWithFormat:@"%@(双褶)",_pColor];
    }
#endif
    return _pColor;
    
}

@end
